package cn.javase.base.collection._01_Collection接口;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

public class _02_迭代器遍历 {
    public static void main(String[] args) {
        Collection<String> list = new ArrayList<>();
        list.add("1");
        list.add("2");
        list.add("3");
        list.add("4");
        Iterator<String> iterator = list.iterator();
        while (iterator.hasNext()) {
            System.out.print(iterator.next());
        }
    }
}
